" 测试for循环功能

" 测试list的for循环
let numbers = [1, 2, 3, 4, 5]
echo "测试list for循环:"
for num in numbers
    echo "数字: " . num
endfor

" 测试dict的for循环
let person = {'name': 'Alice', 'age': 30, 'city': 'Beijing'}
echo "测试dict for循环:"
for key in keys(person)
    echo key . ": " . person[key]
endfor

" 测试range for循环
echo "测试range for循环:"
for i in range(3)
    echo "i = " . i
endfor

" 测试带条件的for循环
echo "测试带条件的for循环:"
let sum = 0
for i in range(1, 5)
    if i % 2 == 0
        let sum = sum + i
    endif
endfor
echo "偶数和: " . sum

echo "for循环测试完成"